<!--
  @Description:我的收藏成果
  @author Wangshu
  @date 2019/8/22
-->

<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="__PUBLIC__/css/common/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/css/header.css">
    <link rel="stylesheet" href="__PUBLIC__/css/myCollectDeman.css">
    <link rel="stylesheet" href="__PUBLIC__/css/menu.css">
    <link rel="stylesheet" href="__PUBLIC__/css/common/common.css">
    <title>山东科技大学技术转移公共服务平台-我的收藏</title>
</head>
<body>
<div>
    <div class="top-title">
        <div>
            <span>欢迎登陆山东科技大学技术转移公共服务平台！</span>
            <if condition="$uid eq null">
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('login/index')}">登录</a>
                    <span class="spece">|</span>
                    <a href="{:url('login/signup')}">注册</a>
                </div>
                <else/>
                <div class="login">
                    <img src="__PUBLIC__/asset/icon/people.png" alt="">
                    <a href="{:url('me/me')}">欢迎你！</a>
                    <a href="{:url('me/me')}">{$user.real_name}</a>
                </div>
            </if>
        </div>
    </div>
    <div class="logo-box">
        <div class="logo-wrap">
            <div>
                <img src="__PUBLIC__/asset/fodder/logo.png" alt="">
            </div>
            <div>
                <div class="search">
                    <div class="dropdown">
                        <div class="btn select-default dropdown-toggle" type="button" id="dropdownMenu1"
                             data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                            请选择学院
                            <span><img style="width: 20px;" src="__PUBLIC__/asset/icon/dropdown.png" alt=""></span>
                        </div>
                        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                            <foreach name="allColleges" item="vo">
                                <li><a onclick="shows1($(this).text(),{$vo.id})">{$vo.college_name}</a></li>
                            </foreach>
                        </ul>
                    </div>
                    <div class="search-block">
                        <input type="text" name="keyword" id="keyword">
                    </div>
                    <div class="submit" id="submit">
                        <img src="__PUBLIC__/asset/icon/search.png" alt="">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="nav-box">
        <div class="nav-list">
            <ul>
                <li><a href="{:url('/index/index')}">首页</a></li>
                <li><a href="{:url('news/index')}">新闻</a></li>
                <li><a href="{:url('people/index')}">人才库</a></li>
                <li><a href="{:url('fruit/index')}">成果库</a></li>
                <if condition="$user_type eq 0">
                    <li><a href="{:url('requirement/index')}">需求库</a></li>
                </if>
                <li class=""><a href="{:url('me/callme')}">联系我们</a></li>
            </ul>
        </div>
    </div>
</div>
<main>
    <div class="content-wrap">
        <div class="menu-left">
            <div class="title">个人中心</div>
            <ul>
                <li>
                    <a href="./me.html">个人资料</a>
                    <img src="__PUBLIC__/asset/icon/right_arrow.png" alt="">
                </li>
                <if condition="$user_type eq 0">
                    <li><a href="./fruit.html">我发布的成果</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                </if>
                <li><a href="./requirement.html">我发布的需求</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <if condition="$user_type eq 0">
                    <li><a href="./team.html">我的团队</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                </if>
                <li class="active"><a href="./collection.html">我的收藏</a><img class="active-arrow"
                                                                            src="__PUBLIC__/asset/icon/right_arrow.png"
                                                                            alt=""></li>
                <li><a href="./FAQ.html">常见问题</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <li><a href="./callMe.html">联系客服</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
                <li><a href="./other.html">其他设置</a><img src="__PUBLIC__/asset/icon/right_arrow.png" alt=""></li>
            </ul>
        </div>
        <div class="menu-right">
            <div class="title">
                <div>个人资料</div>
                <div>当前位置：<span>个人中心/我的收藏</span></div>
            </div>
            <div class="tab">
                <div><a href="./collection.html">人才</a></div>
                <div><a href="./collection_f.html">成果</a></div>
                <div><a href="./collection_r.html">需求</a></div>
                <div class="active"><a href="">团队</a></div>
            </div>
            <div class="list">
                <ul class="list-box">
                    <foreach name="teams" item="vo">
                        <li id="team_{$vo.id}">
                            <div class="left">
                                <div>
                                    <a href="{:url('people/teamDetail')}?id={$vo.id}">{$vo.team_name}</a>
                                </div>
                                <div class="art-info"><span>发布者：{$vo.founder_name}</span>
                                    <span>发布时间：{$vo.create_time|date="Y/m/d"}</span></div>
                            </div>
                            <div class="collct" onclick="unCollect({$vo.id})">
                                <div>取消收藏</div>
                            </div>
                        </li>
                    </foreach>
                </ul>
                <!--暂无内容-->
                <div class="not-list" style="display: none; width: 50%; margin:50px auto;">
                    <img src="__PUBLIC__/asset/icon/not_list.png" alt="">
                </div>
                <!--翻页-->
                <if condition="$maxPage gt 1">
                    <div class="page">
                        <div class="page-btn" onclick="forePage({$page})">上一页</div>
                        <div class="page-num">
                            <?php
                                for($i = 1; $i <= $maxPage; $i++){
                                    if($i == $page){
                                    echo  '<div class="page-active" onclick="page('.$i.')">'.$i.'
                        </div>
                        ';
                        }else{
                        echo '
                        <div onclick="page('.$i.')">'.$i.'</div>
                        ';
                        }

                        }

                        ?>
                    </div>
                    <div class="page-btn" onclick="nextPage({$page})">下一页</div>
                </if>
            </div>
        </div>
    </div>
</main>
<footer>
    <div class="foot-line">
        <span>青岛校区地址：山东省青岛市黄岛区前湾港路579号</span>
        <span>邮政编码：266590</span>
        <span>联系电话：0532-80698028\80698027\80678029</span>
        <span>传真：0532-80698029</span>
    </div>
    <div class="foot-line">
        <span>泰安校区地址：山东省泰安市岱宗大街223号</span>
        <span>邮政编码：271019</span>
        <span>联系电话：0538-3076489</span>
        <span>传真：0538-3076489</span>
    </div>
    <div class="last-line">
        Copyright©2019 　山东科技大学 　鲁ICP备09051012号
        <span style="line-height: 26px ; margin-left: 20px;"><img
                style="width: 44px;height: 17px; margin-right: 10px;vertical-align: middle"
                src="__PUBLIC__/asset/fodder/todo_white.png" alt=""><span
                style="vertical-align: middle">投道科技提供技术支持</span></span>
    </div>
    <div></div>
</footer>
<script src="__PUBLIC__/js/public/jquery-1.11.3.min.js"></script>
<script src="__PUBLIC__/js/public/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/layer/layer/layer.js"></script>
<script>
    $('.collct').on('click', function () {
        layer.msg('取消成功', {
            time: 1500,
        });
    })
    $('.dropdown-toggle').dropdown()

    var selectCollege = null;

    function shows1(a, id) {
        selectCollege = {id, college: a};
        $("#dropdownMenu1").text(a);
    }




    function unCollect(id) {
        $.post('uncollect', {type: 4, cid: id}, function (res) {
            if (res.code == 0) {
                return layer.msg(res.msg)
            } else {
                $(`#team_${id}`).remove();
            }
        })
    }

    // 获取列表的数量
    let itemLength = $('.list-box').children('li').length
    if (itemLength === 0) {
        $('.not-list').show()
        $('.list-box').hide()
    }

    function forePage(page) {
        window.location.href = "{:url('collection_t')}?page=" + (page - 1 > 1 ? page - 1 : 1);
    }

    function nextPage(page) {
        if (page == parseInt(`{$maxPage}`)) {
            return;
        } else {
            window.location.href = "{:url('collection_t')}?page=" + (page + 1 < parseInt(`{$maxPage}`) ? page + 1 : parseInt(`{$maxPage}`));
        }
    }

    function page(page) {
        window.location.href = "{:url('collection_t')}?page=" + page;
    }
</script>
</body>
</html>
